<template>
  <div class="home-page">
    <div class="header">
      <div class="swipe">
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
          <van-swipe-item v-for="item in imgList" :key="item.id"
            ><img
              class="swiperImg"
              :src="`http://liufusong.top:8080${item.imgSrc}`"
              alt=""
          /></van-swipe-item>
        </van-swipe>
      </div>
      <div class="up">
        <div class="search">
          <div class="left">
            <div class="location">上海</div>
            <van-search v-model="value" placeholder="请输入小区或地址" />
          </div>
        </div>
        <div class="map">地图</div>
      </div>
    </div>
  </div>
</template>

<script>
import { getHomeSwiper } from "@/api/search";
export default {
  name: "home-page",
  data() {
    return {
      value: "",
      imgList: [],
    };
  },
  async created() {
    const { body } = await getHomeSwiper();
    console.log(body);
    this.imgList = body;
  },
};
</script>

<style lang="less" scoped>
.header {
  position: relative;
}
.up{
  display: flex;
  position: absolute;
  top: 10%;
}
.search {
  flex: 1;
  display: flex;
  margin: 0 15px;
  background-color: #fff;
  height: 34px;
  border-radius: 5px;
  .left {
    flex: 1;
    display: flex;
    .location {
      padding-left: 10px;
      font-size: 14px;
      line-height: 34px;
    }
  }
  .map {
    width: 34px;
    height: 34px;
  }
}
.van-search {
  border-radius: 3px;
}
.van-field {
  padding: 0;
}
.my-swipe .van-swipe-item {
  .swiperImg {
    width: 100%;
    height: 212px;
  }
}
.custom-indicator {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 2px 5px;
  font-size: 12px;
  background: rgba(0, 0, 0, 0.1);
}
</style>
